/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TimeRecording.forms.renderers;

import java.awt.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
/**
 * Table cell renderer for currency.
 *
 *
 * @author cbegg
 */
public class TimeCellRenderer extends DefaultTableCellRenderer {

    private SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {

        if (value instanceof Date) {
            value = formatter.format(value);
        }
        
        return super.getTableCellRendererComponent(table, value, isSelected,
                hasFocus, row, column);
    }
}
